// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.creative.creativerects;

public class OpenSimplexNoise {
    private static final double STRETCH_CONSTANT_2D = -0.211324865405187;
    private static final double SQUISH_CONSTANT_2D = 0.366025403784439;
    private static final double STRETCH_CONSTANT_3D = -0.16666666666666666;
    private static final double SQUISH_CONSTANT_3D = 0.3333333333333333;
    private static final double STRETCH_CONSTANT_4D = -0.138196601125011;
    private static final double SQUISH_CONSTANT_4D = 0.309016994374947;
    private static final double NORM_CONSTANT_2D = 47.0;
    private static final double NORM_CONSTANT_3D = 103.0;
    private static final double NORM_CONSTANT_4D = 30.0;
    private static final long DEFAULT_SEED = 0L;
    private short[] perm;
    private short[] permGradIndex3D;
    private static byte[] gradients2D = new byte[]{5, 2, 2, 5, -5, 2, -2, 5, 5, -2, 2, -5, -5, -2, -2, -5};
    private static byte[] gradients3D = new byte[]{
        -11,
        4,
        4,
        -4,
        11,
        4,
        -4,
        4,
        11,
        11,
        4,
        4,
        4,
        11,
        4,
        4,
        4,
        11,
        -11,
        -4,
        4,
        -4,
        -11,
        4,
        -4,
        -4,
        11,
        11,
        -4,
        4,
        4,
        -11,
        4,
        4,
        -4,
        11,
        -11,
        4,
        -4,
        -4,
        11,
        -4,
        -4,
        4,
        -11,
        11,
        4,
        -4,
        4,
        11,
        -4,
        4,
        4,
        -11,
        -11,
        -4,
        -4,
        -4,
        -11,
        -4,
        -4,
        -4,
        -11,
        11,
        -4,
        -4,
        4,
        -11,
        -4,
        4,
        -4,
        -11
    };
    private static byte[] gradients4D = new byte[]{
        3,
        1,
        1,
        1,
        1,
        3,
        1,
        1,
        1,
        1,
        3,
        1,
        1,
        1,
        1,
        3,
        -3,
        1,
        1,
        1,
        -1,
        3,
        1,
        1,
        -1,
        1,
        3,
        1,
        -1,
        1,
        1,
        3,
        3,
        -1,
        1,
        1,
        1,
        -3,
        1,
        1,
        1,
        -1,
        3,
        1,
        1,
        -1,
        1,
        3,
        -3,
        -1,
        1,
        1,
        -1,
        -3,
        1,
        1,
        -1,
        -1,
        3,
        1,
        -1,
        -1,
        1,
        3,
        3,
        1,
        -1,
        1,
        1,
        3,
        -1,
        1,
        1,
        1,
        -3,
        1,
        1,
        1,
        -1,
        3,
        -3,
        1,
        -1,
        1,
        -1,
        3,
        -1,
        1,
        -1,
        1,
        -3,
        1,
        -1,
        1,
        -1,
        3,
        3,
        -1,
        -1,
        1,
        1,
        -3,
        -1,
        1,
        1,
        -1,
        -3,
        1,
        1,
        -1,
        -1,
        3,
        -3,
        -1,
        -1,
        1,
        -1,
        -3,
        -1,
        1,
        -1,
        -1,
        -3,
        1,
        -1,
        -1,
        -1,
        3,
        3,
        1,
        1,
        -1,
        1,
        3,
        1,
        -1,
        1,
        1,
        3,
        -1,
        1,
        1,
        1,
        -3,
        -3,
        1,
        1,
        -1,
        -1,
        3,
        1,
        -1,
        -1,
        1,
        3,
        -1,
        -1,
        1,
        1,
        -3,
        3,
        -1,
        1,
        -1,
        1,
        -3,
        1,
        -1,
        1,
        -1,
        3,
        -1,
        1,
        -1,
        1,
        -3,
        -3,
        -1,
        1,
        -1,
        -1,
        -3,
        1,
        -1,
        -1,
        -1,
        3,
        -1,
        -1,
        -1,
        1,
        -3,
        3,
        1,
        -1,
        -1,
        1,
        3,
        -1,
        -1,
        1,
        1,
        -3,
        -1,
        1,
        1,
        -1,
        -3,
        -3,
        1,
        -1,
        -1,
        -1,
        3,
        -1,
        -1,
        -1,
        1,
        -3,
        -1,
        -1,
        1,
        -1,
        -3,
        3,
        -1,
        -1,
        -1,
        1,
        -3,
        -1,
        -1,
        1,
        -1,
        -3,
        -1,
        1,
        -1,
        -1,
        -3,
        -3,
        -1,
        -1,
        -1,
        -1,
        -3,
        -1,
        -1,
        -1,
        -1,
        -3,
        -1,
        -1,
        -1,
        -1,
        -3
    };

    public OpenSimplexNoise() {
        this(0L);
    }

    public OpenSimplexNoise(short[] _short) {
        this.perm = _short;
        this.permGradIndex3D = new short[256];

        for (int _int = 0; _int < 256; _int++) {
            this.permGradIndex3D[_int] = (short)(_short[_int] % (gradients3D.length / 3) * 3);
        }
    }

    public OpenSimplexNoise(long seed) {
        this.perm = new short[256];
        this.permGradIndex3D = new short[256];
        short[] short0 = new short[256];
        short short1 = 0;

        while (short1 < 256) {
            short0[short1] = short1++;
        }

        seed = seed * 6364136223846793005L + 1442695040888963407L;
        seed = seed * 6364136223846793005L + 1442695040888963407L;
        seed = seed * 6364136223846793005L + 1442695040888963407L;

        for (int int0 = 255; int0 >= 0; int0--) {
            seed = seed * 6364136223846793005L + 1442695040888963407L;
            int int1 = (int)((seed + 31L) % (long)(int0 + 1));
            if (int1 < 0) {
                int1 += int0 + 1;
            }

            this.perm[int0] = short0[int1];
            this.permGradIndex3D[int0] = (short)(this.perm[int0] % (gradients3D.length / 3) * 3);
            short0[int1] = short0[int0];
        }
    }

    public double eval(double x, double y) {
        double double0 = (x + y) * -0.211324865405187;
        double double1 = x + double0;
        double double2 = y + double0;
        int int0 = fastFloor(double1);
        int int1 = fastFloor(double2);
        double double3 = (double)(int0 + int1) * 0.366025403784439;
        double double4 = (double)int0 + double3;
        double double5 = (double)int1 + double3;
        double double6 = double1 - (double)int0;
        double double7 = double2 - (double)int1;
        double double8 = double6 + double7;
        double double9 = x - double4;
        double double10 = y - double5;
        double double11 = 0.0;
        double double12 = double9 - 1.0 - 0.366025403784439;
        double double13 = double10 - 0.0 - 0.366025403784439;
        double double14 = 2.0 - double12 * double12 - double13 * double13;
        if (double14 > 0.0) {
            double14 *= double14;
            double11 += double14 * double14 * this.extrapolate(int0 + 1, int1 + 0, double12, double13);
        }

        double double15 = double9 - 0.0 - 0.366025403784439;
        double double16 = double10 - 1.0 - 0.366025403784439;
        double double17 = 2.0 - double15 * double15 - double16 * double16;
        if (double17 > 0.0) {
            double17 *= double17;
            double11 += double17 * double17 * this.extrapolate(int0 + 0, int1 + 1, double15, double16);
        }

        double double18;
        double double19;
        int int2;
        int int3;
        if (double8 <= 1.0) {
            double double20 = 1.0 - double8;
            if (!(double20 > double6) && !(double20 > double7)) {
                int2 = int0 + 1;
                int3 = int1 + 1;
                double18 = double9 - 1.0 - 0.732050807568878;
                double19 = double10 - 1.0 - 0.732050807568878;
            } else if (double6 > double7) {
                int2 = int0 + 1;
                int3 = int1 - 1;
                double18 = double9 - 1.0;
                double19 = double10 + 1.0;
            } else {
                int2 = int0 - 1;
                int3 = int1 + 1;
                double18 = double9 + 1.0;
                double19 = double10 - 1.0;
            }
        } else {
            double double21 = 2.0 - double8;
            if (!(double21 < double6) && !(double21 < double7)) {
                double18 = double9;
                double19 = double10;
                int2 = int0;
                int3 = int1;
            } else if (double6 > double7) {
                int2 = int0 + 2;
                int3 = int1 + 0;
                double18 = double9 - 2.0 - 0.732050807568878;
                double19 = double10 + 0.0 - 0.732050807568878;
            } else {
                int2 = int0 + 0;
                int3 = int1 + 2;
                double18 = double9 + 0.0 - 0.732050807568878;
                double19 = double10 - 2.0 - 0.732050807568878;
            }

            int0++;
            int1++;
            double9 = double9 - 1.0 - 0.732050807568878;
            double10 = double10 - 1.0 - 0.732050807568878;
        }

        double double22 = 2.0 - double9 * double9 - double10 * double10;
        if (double22 > 0.0) {
            double22 *= double22;
            double11 += double22 * double22 * this.extrapolate(int0, int1, double9, double10);
        }

        double double23 = 2.0 - double18 * double18 - double19 * double19;
        if (double23 > 0.0) {
            double23 *= double23;
            double11 += double23 * double23 * this.extrapolate(int2, int3, double18, double19);
        }

        return double11 / 47.0;
    }

    public double eval(double x, double y, double z) {
        double double0 = (x + y + z) * -0.16666666666666666;
        double double1 = x + double0;
        double double2 = y + double0;
        double double3 = z + double0;
        int int0 = fastFloor(double1);
        int int1 = fastFloor(double2);
        int int2 = fastFloor(double3);
        double double4 = (double)(int0 + int1 + int2) * 0.3333333333333333;
        double double5 = (double)int0 + double4;
        double double6 = (double)int1 + double4;
        double double7 = (double)int2 + double4;
        double double8 = double1 - (double)int0;
        double double9 = double2 - (double)int1;
        double double10 = double3 - (double)int2;
        double double11 = double8 + double9 + double10;
        double double12 = x - double5;
        double double13 = y - double6;
        double double14 = z - double7;
        double double15 = 0.0;
        double double16;
        double double17;
        double double18;
        double double19;
        double double20;
        double double21;
        int int3;
        int int4;
        int int5;
        int int6;
        int int7;
        int int8;
        if (double11 <= 1.0) {
            byte byte0 = 1;
            double double22 = double8;
            byte byte1 = 2;
            double double23 = double9;
            if (double8 >= double9 && double10 > double9) {
                double23 = double10;
                byte1 = 4;
            } else if (double8 < double9 && double10 > double8) {
                double22 = double10;
                byte0 = 4;
            }

            double double24 = 1.0 - double11;
            if (!(double24 > double22) && !(double24 > double23)) {
                byte byte2 = (byte)(byte0 | byte1);
                if ((byte2 & 1) == 0) {
                    int3 = int0;
                    int6 = int0 - 1;
                    double16 = double12 - 0.6666666666666666;
                    double19 = double12 + 1.0 - 0.3333333333333333;
                } else {
                    int3 = int6 = int0 + 1;
                    double16 = double12 - 1.0 - 0.6666666666666666;
                    double19 = double12 - 1.0 - 0.3333333333333333;
                }

                if ((byte2 & 2) == 0) {
                    int4 = int1;
                    int7 = int1 - 1;
                    double17 = double13 - 0.6666666666666666;
                    double20 = double13 + 1.0 - 0.3333333333333333;
                } else {
                    int4 = int7 = int1 + 1;
                    double17 = double13 - 1.0 - 0.6666666666666666;
                    double20 = double13 - 1.0 - 0.3333333333333333;
                }

                if ((byte2 & 4) == 0) {
                    int5 = int2;
                    int8 = int2 - 1;
                    double18 = double14 - 0.6666666666666666;
                    double21 = double14 + 1.0 - 0.3333333333333333;
                } else {
                    int5 = int8 = int2 + 1;
                    double18 = double14 - 1.0 - 0.6666666666666666;
                    double21 = double14 - 1.0 - 0.3333333333333333;
                }
            } else {
                byte byte3 = double23 > double22 ? byte1 : byte0;
                if ((byte3 & 1) == 0) {
                    int3 = int0 - 1;
                    int6 = int0;
                    double16 = double12 + 1.0;
                    double19 = double12;
                } else {
                    int3 = int6 = int0 + 1;
                    double16 = double19 = double12 - 1.0;
                }

                if ((byte3 & 2) == 0) {
                    int7 = int1;
                    int4 = int1;
                    double20 = double13;
                    double17 = double13;
                    if ((byte3 & 1) == 0) {
                        int7 = int1 - 1;
                        double20 = double13 + 1.0;
                    } else {
                        int4 = int1 - 1;
                        double17 = double13 + 1.0;
                    }
                } else {
                    int4 = int7 = int1 + 1;
                    double17 = double20 = double13 - 1.0;
                }

                if ((byte3 & 4) == 0) {
                    int5 = int2;
                    int8 = int2 - 1;
                    double18 = double14;
                    double21 = double14 + 1.0;
                } else {
                    int5 = int8 = int2 + 1;
                    double18 = double21 = double14 - 1.0;
                }
            }

            double double25 = 2.0 - double12 * double12 - double13 * double13 - double14 * double14;
            if (double25 > 0.0) {
                double25 *= double25;
                double15 += double25 * double25 * this.extrapolate(int0 + 0, int1 + 0, int2 + 0, double12, double13, double14);
            }

            double double26 = double12 - 1.0 - 0.3333333333333333;
            double double27 = double13 - 0.0 - 0.3333333333333333;
            double double28 = double14 - 0.0 - 0.3333333333333333;
            double double29 = 2.0 - double26 * double26 - double27 * double27 - double28 * double28;
            if (double29 > 0.0) {
                double29 *= double29;
                double15 += double29 * double29 * this.extrapolate(int0 + 1, int1 + 0, int2 + 0, double26, double27, double28);
            }

            double double30 = double12 - 0.0 - 0.3333333333333333;
            double double31 = double13 - 1.0 - 0.3333333333333333;
            double double32 = 2.0 - double30 * double30 - double31 * double31 - double28 * double28;
            if (double32 > 0.0) {
                double32 *= double32;
                double15 += double32 * double32 * this.extrapolate(int0 + 0, int1 + 1, int2 + 0, double30, double31, double28);
            }

            double double33 = double14 - 1.0 - 0.3333333333333333;
            double double34 = 2.0 - double30 * double30 - double27 * double27 - double33 * double33;
            if (double34 > 0.0) {
                double34 *= double34;
                double15 += double34 * double34 * this.extrapolate(int0 + 0, int1 + 0, int2 + 1, double30, double27, double33);
            }
        } else if (double11 >= 2.0) {
            byte byte4 = 6;
            double double35 = double8;
            byte byte5 = 5;
            double double36 = double9;
            if (double8 <= double9 && double10 < double9) {
                double36 = double10;
                byte5 = 3;
            } else if (double8 > double9 && double10 < double8) {
                double35 = double10;
                byte4 = 3;
            }

            double double37 = 3.0 - double11;
            if (!(double37 < double35) && !(double37 < double36)) {
                byte byte6 = (byte)(byte4 & byte5);
                if ((byte6 & 1) != 0) {
                    int3 = int0 + 1;
                    int6 = int0 + 2;
                    double16 = double12 - 1.0 - 0.3333333333333333;
                    double19 = double12 - 2.0 - 0.6666666666666666;
                } else {
                    int6 = int0;
                    int3 = int0;
                    double16 = double12 - 0.3333333333333333;
                    double19 = double12 - 0.6666666666666666;
                }

                if ((byte6 & 2) != 0) {
                    int4 = int1 + 1;
                    int7 = int1 + 2;
                    double17 = double13 - 1.0 - 0.3333333333333333;
                    double20 = double13 - 2.0 - 0.6666666666666666;
                } else {
                    int7 = int1;
                    int4 = int1;
                    double17 = double13 - 0.3333333333333333;
                    double20 = double13 - 0.6666666666666666;
                }

                if ((byte6 & 4) != 0) {
                    int5 = int2 + 1;
                    int8 = int2 + 2;
                    double18 = double14 - 1.0 - 0.3333333333333333;
                    double21 = double14 - 2.0 - 0.6666666666666666;
                } else {
                    int8 = int2;
                    int5 = int2;
                    double18 = double14 - 0.3333333333333333;
                    double21 = double14 - 0.6666666666666666;
                }
            } else {
                byte byte7 = double36 < double35 ? byte5 : byte4;
                if ((byte7 & 1) != 0) {
                    int3 = int0 + 2;
                    int6 = int0 + 1;
                    double16 = double12 - 2.0 - 1.0;
                    double19 = double12 - 1.0 - 1.0;
                } else {
                    int6 = int0;
                    int3 = int0;
                    double16 = double19 = double12 - 1.0;
                }

                if ((byte7 & 2) != 0) {
                    int4 = int7 = int1 + 1;
                    double17 = double20 = double13 - 1.0 - 1.0;
                    if ((byte7 & 1) != 0) {
                        int7++;
                        double20--;
                    } else {
                        int4++;
                        double17--;
                    }
                } else {
                    int7 = int1;
                    int4 = int1;
                    double17 = double20 = double13 - 1.0;
                }

                if ((byte7 & 4) != 0) {
                    int5 = int2 + 1;
                    int8 = int2 + 2;
                    double18 = double14 - 1.0 - 1.0;
                    double21 = double14 - 2.0 - 1.0;
                } else {
                    int8 = int2;
                    int5 = int2;
                    double18 = double21 = double14 - 1.0;
                }
            }

            double double38 = double12 - 1.0 - 0.6666666666666666;
            double double39 = double13 - 1.0 - 0.6666666666666666;
            double double40 = double14 - 0.0 - 0.6666666666666666;
            double double41 = 2.0 - double38 * double38 - double39 * double39 - double40 * double40;
            if (double41 > 0.0) {
                double41 *= double41;
                double15 += double41 * double41 * this.extrapolate(int0 + 1, int1 + 1, int2 + 0, double38, double39, double40);
            }

            double double42 = double13 - 0.0 - 0.6666666666666666;
            double double43 = double14 - 1.0 - 0.6666666666666666;
            double double44 = 2.0 - double38 * double38 - double42 * double42 - double43 * double43;
            if (double44 > 0.0) {
                double44 *= double44;
                double15 += double44 * double44 * this.extrapolate(int0 + 1, int1 + 0, int2 + 1, double38, double42, double43);
            }

            double double45 = double12 - 0.0 - 0.6666666666666666;
            double double46 = 2.0 - double45 * double45 - double39 * double39 - double43 * double43;
            if (double46 > 0.0) {
                double46 *= double46;
                double15 += double46 * double46 * this.extrapolate(int0 + 0, int1 + 1, int2 + 1, double45, double39, double43);
            }

            double12 = double12 - 1.0 - 1.0;
            double13 = double13 - 1.0 - 1.0;
            double14 = double14 - 1.0 - 1.0;
            double double47 = 2.0 - double12 * double12 - double13 * double13 - double14 * double14;
            if (double47 > 0.0) {
                double47 *= double47;
                double15 += double47 * double47 * this.extrapolate(int0 + 1, int1 + 1, int2 + 1, double12, double13, double14);
            }
        } else {
            double double48 = double8 + double9;
            byte byte8;
            double double49;
            boolean boolean0;
            if (double48 > 1.0) {
                double49 = double48 - 1.0;
                byte8 = 3;
                boolean0 = true;
            } else {
                double49 = 1.0 - double48;
                byte8 = 4;
                boolean0 = false;
            }

            double double50 = double8 + double10;
            boolean boolean1;
            double double51;
            byte byte9;
            if (double50 > 1.0) {
                double51 = double50 - 1.0;
                byte9 = 5;
                boolean1 = true;
            } else {
                double51 = 1.0 - double50;
                byte9 = 2;
                boolean1 = false;
            }

            double double52 = double9 + double10;
            if (double52 > 1.0) {
                double double53 = double52 - 1.0;
                if (double49 <= double51 && double49 < double53) {
                    byte8 = 6;
                    boolean0 = true;
                } else if (double49 > double51 && double51 < double53) {
                    byte9 = 6;
                    boolean1 = true;
                }
            } else {
                double double54 = 1.0 - double52;
                if (double49 <= double51 && double49 < double54) {
                    byte8 = 1;
                    boolean0 = false;
                } else if (double49 > double51 && double51 < double54) {
                    byte9 = 1;
                    boolean1 = false;
                }
            }

            if (boolean0 == boolean1) {
                if (boolean0) {
                    double16 = double12 - 1.0 - 1.0;
                    double17 = double13 - 1.0 - 1.0;
                    double18 = double14 - 1.0 - 1.0;
                    int3 = int0 + 1;
                    int4 = int1 + 1;
                    int5 = int2 + 1;
                    byte byte10 = (byte)(byte8 & byte9);
                    if ((byte10 & 1) != 0) {
                        double19 = double12 - 2.0 - 0.6666666666666666;
                        double20 = double13 - 0.6666666666666666;
                        double21 = double14 - 0.6666666666666666;
                        int6 = int0 + 2;
                        int7 = int1;
                        int8 = int2;
                    } else if ((byte10 & 2) != 0) {
                        double19 = double12 - 0.6666666666666666;
                        double20 = double13 - 2.0 - 0.6666666666666666;
                        double21 = double14 - 0.6666666666666666;
                        int6 = int0;
                        int7 = int1 + 2;
                        int8 = int2;
                    } else {
                        double19 = double12 - 0.6666666666666666;
                        double20 = double13 - 0.6666666666666666;
                        double21 = double14 - 2.0 - 0.6666666666666666;
                        int6 = int0;
                        int7 = int1;
                        int8 = int2 + 2;
                    }
                } else {
                    double16 = double12;
                    double17 = double13;
                    double18 = double14;
                    int3 = int0;
                    int4 = int1;
                    int5 = int2;
                    byte byte11 = (byte)(byte8 | byte9);
                    if ((byte11 & 1) == 0) {
                        double19 = double12 + 1.0 - 0.3333333333333333;
                        double20 = double13 - 1.0 - 0.3333333333333333;
                        double21 = double14 - 1.0 - 0.3333333333333333;
                        int6 = int0 - 1;
                        int7 = int1 + 1;
                        int8 = int2 + 1;
                    } else if ((byte11 & 2) == 0) {
                        double19 = double12 - 1.0 - 0.3333333333333333;
                        double20 = double13 + 1.0 - 0.3333333333333333;
                        double21 = double14 - 1.0 - 0.3333333333333333;
                        int6 = int0 + 1;
                        int7 = int1 - 1;
                        int8 = int2 + 1;
                    } else {
                        double19 = double12 - 1.0 - 0.3333333333333333;
                        double20 = double13 - 1.0 - 0.3333333333333333;
                        double21 = double14 + 1.0 - 0.3333333333333333;
                        int6 = int0 + 1;
                        int7 = int1 + 1;
                        int8 = int2 - 1;
                    }
                }
            } else {
                byte byte12;
                byte byte13;
                if (boolean0) {
                    byte13 = byte8;
                    byte12 = byte9;
                } else {
                    byte13 = byte9;
                    byte12 = byte8;
                }

                if ((byte13 & 1) == 0) {
                    double16 = double12 + 1.0 - 0.3333333333333333;
                    double17 = double13 - 1.0 - 0.3333333333333333;
                    double18 = double14 - 1.0 - 0.3333333333333333;
                    int3 = int0 - 1;
                    int4 = int1 + 1;
                    int5 = int2 + 1;
                } else if ((byte13 & 2) == 0) {
                    double16 = double12 - 1.0 - 0.3333333333333333;
                    double17 = double13 + 1.0 - 0.3333333333333333;
                    double18 = double14 - 1.0 - 0.3333333333333333;
                    int3 = int0 + 1;
                    int4 = int1 - 1;
                    int5 = int2 + 1;
                } else {
                    double16 = double12 - 1.0 - 0.3333333333333333;
                    double17 = double13 - 1.0 - 0.3333333333333333;
                    double18 = double14 + 1.0 - 0.3333333333333333;
                    int3 = int0 + 1;
                    int4 = int1 + 1;
                    int5 = int2 - 1;
                }

                double19 = double12 - 0.6666666666666666;
                double20 = double13 - 0.6666666666666666;
                double21 = double14 - 0.6666666666666666;
                int6 = int0;
                int7 = int1;
                int8 = int2;
                if ((byte12 & 1) != 0) {
                    double19 -= 2.0;
                    int6 = int0 + 2;
                } else if ((byte12 & 2) != 0) {
                    double20 -= 2.0;
                    int7 = int1 + 2;
                } else {
                    double21 -= 2.0;
                    int8 = int2 + 2;
                }
            }

            double double55 = double12 - 1.0 - 0.3333333333333333;
            double double56 = double13 - 0.0 - 0.3333333333333333;
            double double57 = double14 - 0.0 - 0.3333333333333333;
            double double58 = 2.0 - double55 * double55 - double56 * double56 - double57 * double57;
            if (double58 > 0.0) {
                double58 *= double58;
                double15 += double58 * double58 * this.extrapolate(int0 + 1, int1 + 0, int2 + 0, double55, double56, double57);
            }

            double double59 = double12 - 0.0 - 0.3333333333333333;
            double double60 = double13 - 1.0 - 0.3333333333333333;
            double double61 = 2.0 - double59 * double59 - double60 * double60 - double57 * double57;
            if (double61 > 0.0) {
                double61 *= double61;
                double15 += double61 * double61 * this.extrapolate(int0 + 0, int1 + 1, int2 + 0, double59, double60, double57);
            }

            double double62 = double14 - 1.0 - 0.3333333333333333;
            double double63 = 2.0 - double59 * double59 - double56 * double56 - double62 * double62;
            if (double63 > 0.0) {
                double63 *= double63;
                double15 += double63 * double63 * this.extrapolate(int0 + 0, int1 + 0, int2 + 1, double59, double56, double62);
            }

            double double64 = double12 - 1.0 - 0.6666666666666666;
            double double65 = double13 - 1.0 - 0.6666666666666666;
            double double66 = double14 - 0.0 - 0.6666666666666666;
            double double67 = 2.0 - double64 * double64 - double65 * double65 - double66 * double66;
            if (double67 > 0.0) {
                double67 *= double67;
                double15 += double67 * double67 * this.extrapolate(int0 + 1, int1 + 1, int2 + 0, double64, double65, double66);
            }

            double double68 = double13 - 0.0 - 0.6666666666666666;
            double double69 = double14 - 1.0 - 0.6666666666666666;
            double double70 = 2.0 - double64 * double64 - double68 * double68 - double69 * double69;
            if (double70 > 0.0) {
                double70 *= double70;
                double15 += double70 * double70 * this.extrapolate(int0 + 1, int1 + 0, int2 + 1, double64, double68, double69);
            }

            double double71 = double12 - 0.0 - 0.6666666666666666;
            double double72 = 2.0 - double71 * double71 - double65 * double65 - double69 * double69;
            if (double72 > 0.0) {
                double72 *= double72;
                double15 += double72 * double72 * this.extrapolate(int0 + 0, int1 + 1, int2 + 1, double71, double65, double69);
            }
        }

        double double73 = 2.0 - double16 * double16 - double17 * double17 - double18 * double18;
        if (double73 > 0.0) {
            double73 *= double73;
            double15 += double73 * double73 * this.extrapolate(int3, int4, int5, double16, double17, double18);
        }

        double double74 = 2.0 - double19 * double19 - double20 * double20 - double21 * double21;
        if (double74 > 0.0) {
            double74 *= double74;
            double15 += double74 * double74 * this.extrapolate(int6, int7, int8, double19, double20, double21);
        }

        return double15 / 103.0;
    }

    public double eval(double x, double y, double z, double w) {
        double double0 = (x + y + z + w) * -0.138196601125011;
        double double1 = x + double0;
        double double2 = y + double0;
        double double3 = z + double0;
        double double4 = w + double0;
        int int0 = fastFloor(double1);
        int int1 = fastFloor(double2);
        int int2 = fastFloor(double3);
        int int3 = fastFloor(double4);
        double double5 = (double)(int0 + int1 + int2 + int3) * 0.309016994374947;
        double double6 = (double)int0 + double5;
        double double7 = (double)int1 + double5;
        double double8 = (double)int2 + double5;
        double double9 = (double)int3 + double5;
        double double10 = double1 - (double)int0;
        double double11 = double2 - (double)int1;
        double double12 = double3 - (double)int2;
        double double13 = double4 - (double)int3;
        double double14 = double10 + double11 + double12 + double13;
        double double15 = x - double6;
        double double16 = y - double7;
        double double17 = z - double8;
        double double18 = w - double9;
        double double19 = 0.0;
        double double20;
        double double21;
        double double22;
        double double23;
        double double24;
        double double25;
        double double26;
        double double27;
        double double28;
        double double29;
        double double30;
        double double31;
        int int4;
        int int5;
        int int6;
        int int7;
        int int8;
        int int9;
        int int10;
        int int11;
        int int12;
        int int13;
        int int14;
        int int15;
        if (double14 <= 1.0) {
            byte byte0 = 1;
            double double32 = double10;
            byte byte1 = 2;
            double double33 = double11;
            if (double10 >= double11 && double12 > double11) {
                double33 = double12;
                byte1 = 4;
            } else if (double10 < double11 && double12 > double10) {
                double32 = double12;
                byte0 = 4;
            }

            if (double32 >= double33 && double13 > double33) {
                double33 = double13;
                byte1 = 8;
            } else if (double32 < double33 && double13 > double32) {
                double32 = double13;
                byte0 = 8;
            }

            double double34 = 1.0 - double14;
            if (!(double34 > double32) && !(double34 > double33)) {
                byte byte2 = (byte)(byte0 | byte1);
                if ((byte2 & 1) == 0) {
                    int12 = int0;
                    int4 = int0;
                    int8 = int0 - 1;
                    double20 = double15 - 0.618033988749894;
                    double24 = double15 + 1.0 - 0.309016994374947;
                    double28 = double15 - 0.309016994374947;
                } else {
                    int4 = int8 = int12 = int0 + 1;
                    double20 = double15 - 1.0 - 0.618033988749894;
                    double24 = double28 = double15 - 1.0 - 0.309016994374947;
                }

                if ((byte2 & 2) == 0) {
                    int13 = int1;
                    int9 = int1;
                    int5 = int1;
                    double21 = double16 - 0.618033988749894;
                    double25 = double29 = double16 - 0.309016994374947;
                    if ((byte2 & 1) == 1) {
                        int9 = int1 - 1;
                        double25++;
                    } else {
                        int13 = int1 - 1;
                        double29++;
                    }
                } else {
                    int5 = int9 = int13 = int1 + 1;
                    double21 = double16 - 1.0 - 0.618033988749894;
                    double25 = double29 = double16 - 1.0 - 0.309016994374947;
                }

                if ((byte2 & 4) == 0) {
                    int14 = int2;
                    int10 = int2;
                    int6 = int2;
                    double22 = double17 - 0.618033988749894;
                    double26 = double30 = double17 - 0.309016994374947;
                    if ((byte2 & 3) == 3) {
                        int10 = int2 - 1;
                        double26++;
                    } else {
                        int14 = int2 - 1;
                        double30++;
                    }
                } else {
                    int6 = int10 = int14 = int2 + 1;
                    double22 = double17 - 1.0 - 0.618033988749894;
                    double26 = double30 = double17 - 1.0 - 0.309016994374947;
                }

                if ((byte2 & 8) == 0) {
                    int11 = int3;
                    int7 = int3;
                    int15 = int3 - 1;
                    double23 = double18 - 0.618033988749894;
                    double27 = double18 - 0.309016994374947;
                    double31 = double18 + 1.0 - 0.309016994374947;
                } else {
                    int7 = int11 = int15 = int3 + 1;
                    double23 = double18 - 1.0 - 0.618033988749894;
                    double27 = double31 = double18 - 1.0 - 0.309016994374947;
                }
            } else {
                byte byte3 = double33 > double32 ? byte1 : byte0;
                if ((byte3 & 1) == 0) {
                    int4 = int0 - 1;
                    int12 = int0;
                    int8 = int0;
                    double20 = double15 + 1.0;
                    double28 = double15;
                    double24 = double15;
                } else {
                    int4 = int8 = int12 = int0 + 1;
                    double20 = double24 = double28 = double15 - 1.0;
                }

                if ((byte3 & 2) == 0) {
                    int13 = int1;
                    int9 = int1;
                    int5 = int1;
                    double29 = double16;
                    double25 = double16;
                    double21 = double16;
                    if ((byte3 & 1) == 1) {
                        int5 = int1 - 1;
                        double21 = double16 + 1.0;
                    } else {
                        int9 = int1 - 1;
                        double25 = double16 + 1.0;
                    }
                } else {
                    int5 = int9 = int13 = int1 + 1;
                    double21 = double25 = double29 = double16 - 1.0;
                }

                if ((byte3 & 4) == 0) {
                    int14 = int2;
                    int10 = int2;
                    int6 = int2;
                    double30 = double17;
                    double26 = double17;
                    double22 = double17;
                    if ((byte3 & 3) != 0) {
                        if ((byte3 & 3) == 3) {
                            int6 = int2 - 1;
                            double22 = double17 + 1.0;
                        } else {
                            int10 = int2 - 1;
                            double26 = double17 + 1.0;
                        }
                    } else {
                        int14 = int2 - 1;
                        double30 = double17 + 1.0;
                    }
                } else {
                    int6 = int10 = int14 = int2 + 1;
                    double22 = double26 = double30 = double17 - 1.0;
                }

                if ((byte3 & 8) == 0) {
                    int11 = int3;
                    int7 = int3;
                    int15 = int3 - 1;
                    double27 = double18;
                    double23 = double18;
                    double31 = double18 + 1.0;
                } else {
                    int7 = int11 = int15 = int3 + 1;
                    double23 = double27 = double31 = double18 - 1.0;
                }
            }

            double double35 = 2.0 - double15 * double15 - double16 * double16 - double17 * double17 - double18 * double18;
            if (double35 > 0.0) {
                double35 *= double35;
                double19 += double35 * double35 * this.extrapolate(int0 + 0, int1 + 0, int2 + 0, int3 + 0, double15, double16, double17, double18);
            }

            double double36 = double15 - 1.0 - 0.309016994374947;
            double double37 = double16 - 0.0 - 0.309016994374947;
            double double38 = double17 - 0.0 - 0.309016994374947;
            double double39 = double18 - 0.0 - 0.309016994374947;
            double double40 = 2.0 - double36 * double36 - double37 * double37 - double38 * double38 - double39 * double39;
            if (double40 > 0.0) {
                double40 *= double40;
                double19 += double40 * double40 * this.extrapolate(int0 + 1, int1 + 0, int2 + 0, int3 + 0, double36, double37, double38, double39);
            }

            double double41 = double15 - 0.0 - 0.309016994374947;
            double double42 = double16 - 1.0 - 0.309016994374947;
            double double43 = 2.0 - double41 * double41 - double42 * double42 - double38 * double38 - double39 * double39;
            if (double43 > 0.0) {
                double43 *= double43;
                double19 += double43 * double43 * this.extrapolate(int0 + 0, int1 + 1, int2 + 0, int3 + 0, double41, double42, double38, double39);
            }

            double double44 = double17 - 1.0 - 0.309016994374947;
            double double45 = 2.0 - double41 * double41 - double37 * double37 - double44 * double44 - double39 * double39;
            if (double45 > 0.0) {
                double45 *= double45;
                double19 += double45 * double45 * this.extrapolate(int0 + 0, int1 + 0, int2 + 1, int3 + 0, double41, double37, double44, double39);
            }

            double double46 = double18 - 1.0 - 0.309016994374947;
            double double47 = 2.0 - double41 * double41 - double37 * double37 - double38 * double38 - double46 * double46;
            if (double47 > 0.0) {
                double47 *= double47;
                double19 += double47 * double47 * this.extrapolate(int0 + 0, int1 + 0, int2 + 0, int3 + 1, double41, double37, double38, double46);
            }
        } else if (double14 >= 3.0) {
            byte byte4 = 14;
            double double48 = double10;
            byte byte5 = 13;
            double double49 = double11;
            if (double10 <= double11 && double12 < double11) {
                double49 = double12;
                byte5 = 11;
            } else if (double10 > double11 && double12 < double10) {
                double48 = double12;
                byte4 = 11;
            }

            if (double48 <= double49 && double13 < double49) {
                double49 = double13;
                byte5 = 7;
            } else if (double48 > double49 && double13 < double48) {
                double48 = double13;
                byte4 = 7;
            }

            double double50 = 4.0 - double14;
            if (!(double50 < double48) && !(double50 < double49)) {
                byte byte6 = (byte)(byte4 & byte5);
                if ((byte6 & 1) != 0) {
                    int4 = int12 = int0 + 1;
                    int8 = int0 + 2;
                    double20 = double15 - 1.0 - 0.618033988749894;
                    double24 = double15 - 2.0 - 0.927050983124841;
                    double28 = double15 - 1.0 - 0.927050983124841;
                } else {
                    int12 = int0;
                    int8 = int0;
                    int4 = int0;
                    double20 = double15 - 0.618033988749894;
                    double24 = double28 = double15 - 0.927050983124841;
                }

                if ((byte6 & 2) != 0) {
                    int5 = int9 = int13 = int1 + 1;
                    double21 = double16 - 1.0 - 0.618033988749894;
                    double25 = double29 = double16 - 1.0 - 0.927050983124841;
                    if ((byte6 & 1) != 0) {
                        int13++;
                        double29--;
                    } else {
                        int9++;
                        double25--;
                    }
                } else {
                    int13 = int1;
                    int9 = int1;
                    int5 = int1;
                    double21 = double16 - 0.618033988749894;
                    double25 = double29 = double16 - 0.927050983124841;
                }

                if ((byte6 & 4) != 0) {
                    int6 = int10 = int14 = int2 + 1;
                    double22 = double17 - 1.0 - 0.618033988749894;
                    double26 = double30 = double17 - 1.0 - 0.927050983124841;
                    if ((byte6 & 3) != 0) {
                        int14++;
                        double30--;
                    } else {
                        int10++;
                        double26--;
                    }
                } else {
                    int14 = int2;
                    int10 = int2;
                    int6 = int2;
                    double22 = double17 - 0.618033988749894;
                    double26 = double30 = double17 - 0.927050983124841;
                }

                if ((byte6 & 8) != 0) {
                    int7 = int11 = int3 + 1;
                    int15 = int3 + 2;
                    double23 = double18 - 1.0 - 0.618033988749894;
                    double27 = double18 - 1.0 - 0.927050983124841;
                    double31 = double18 - 2.0 - 0.927050983124841;
                } else {
                    int15 = int3;
                    int11 = int3;
                    int7 = int3;
                    double23 = double18 - 0.618033988749894;
                    double27 = double31 = double18 - 0.927050983124841;
                }
            } else {
                byte byte7 = double49 < double48 ? byte5 : byte4;
                if ((byte7 & 1) != 0) {
                    int4 = int0 + 2;
                    int8 = int12 = int0 + 1;
                    double20 = double15 - 2.0 - 1.236067977499788;
                    double24 = double28 = double15 - 1.0 - 1.236067977499788;
                } else {
                    int12 = int0;
                    int8 = int0;
                    int4 = int0;
                    double20 = double24 = double28 = double15 - 1.236067977499788;
                }

                if ((byte7 & 2) != 0) {
                    int5 = int9 = int13 = int1 + 1;
                    double21 = double25 = double29 = double16 - 1.0 - 1.236067977499788;
                    if ((byte7 & 1) != 0) {
                        int9++;
                        double25--;
                    } else {
                        int5++;
                        double21--;
                    }
                } else {
                    int13 = int1;
                    int9 = int1;
                    int5 = int1;
                    double21 = double25 = double29 = double16 - 1.236067977499788;
                }

                if ((byte7 & 4) != 0) {
                    int6 = int10 = int14 = int2 + 1;
                    double22 = double26 = double30 = double17 - 1.0 - 1.236067977499788;
                    if ((byte7 & 3) != 3) {
                        if ((byte7 & 3) == 0) {
                            int6++;
                            double22--;
                        } else {
                            int10++;
                            double26--;
                        }
                    } else {
                        int14++;
                        double30--;
                    }
                } else {
                    int14 = int2;
                    int10 = int2;
                    int6 = int2;
                    double22 = double26 = double30 = double17 - 1.236067977499788;
                }

                if ((byte7 & 8) != 0) {
                    int7 = int11 = int3 + 1;
                    int15 = int3 + 2;
                    double23 = double27 = double18 - 1.0 - 1.236067977499788;
                    double31 = double18 - 2.0 - 1.236067977499788;
                } else {
                    int15 = int3;
                    int11 = int3;
                    int7 = int3;
                    double23 = double27 = double31 = double18 - 1.236067977499788;
                }
            }

            double double51 = double15 - 1.0 - 0.927050983124841;
            double double52 = double16 - 1.0 - 0.927050983124841;
            double double53 = double17 - 1.0 - 0.927050983124841;
            double double54 = double18 - 0.927050983124841;
            double double55 = 2.0 - double51 * double51 - double52 * double52 - double53 * double53 - double54 * double54;
            if (double55 > 0.0) {
                double55 *= double55;
                double19 += double55 * double55 * this.extrapolate(int0 + 1, int1 + 1, int2 + 1, int3 + 0, double51, double52, double53, double54);
            }

            double double56 = double17 - 0.927050983124841;
            double double57 = double18 - 1.0 - 0.927050983124841;
            double double58 = 2.0 - double51 * double51 - double52 * double52 - double56 * double56 - double57 * double57;
            if (double58 > 0.0) {
                double58 *= double58;
                double19 += double58 * double58 * this.extrapolate(int0 + 1, int1 + 1, int2 + 0, int3 + 1, double51, double52, double56, double57);
            }

            double double59 = double16 - 0.927050983124841;
            double double60 = 2.0 - double51 * double51 - double59 * double59 - double53 * double53 - double57 * double57;
            if (double60 > 0.0) {
                double60 *= double60;
                double19 += double60 * double60 * this.extrapolate(int0 + 1, int1 + 0, int2 + 1, int3 + 1, double51, double59, double53, double57);
            }

            double double61 = double15 - 0.927050983124841;
            double double62 = 2.0 - double61 * double61 - double52 * double52 - double53 * double53 - double57 * double57;
            if (double62 > 0.0) {
                double62 *= double62;
                double19 += double62 * double62 * this.extrapolate(int0 + 0, int1 + 1, int2 + 1, int3 + 1, double61, double52, double53, double57);
            }

            double15 = double15 - 1.0 - 1.236067977499788;
            double16 = double16 - 1.0 - 1.236067977499788;
            double17 = double17 - 1.0 - 1.236067977499788;
            double18 = double18 - 1.0 - 1.236067977499788;
            double double63 = 2.0 - double15 * double15 - double16 * double16 - double17 * double17 - double18 * double18;
            if (double63 > 0.0) {
                double63 *= double63;
                double19 += double63 * double63 * this.extrapolate(int0 + 1, int1 + 1, int2 + 1, int3 + 1, double15, double16, double17, double18);
            }
        } else if (double14 <= 2.0) {
            boolean boolean0 = true;
            boolean boolean1 = true;
            byte byte8;
            double double64;
            if (double10 + double11 > double12 + double13) {
                double64 = double10 + double11;
                byte8 = 3;
            } else {
                double64 = double12 + double13;
                byte8 = 12;
            }

            double double65;
            byte byte9;
            if (double10 + double12 > double11 + double13) {
                double65 = double10 + double12;
                byte9 = 5;
            } else {
                double65 = double11 + double13;
                byte9 = 10;
            }

            if (double10 + double13 > double11 + double12) {
                double double66 = double10 + double13;
                if (double64 >= double65 && double66 > double65) {
                    double65 = double66;
                    byte9 = 9;
                } else if (double64 < double65 && double66 > double64) {
                    double64 = double66;
                    byte8 = 9;
                }
            } else {
                double double67 = double11 + double12;
                if (double64 >= double65 && double67 > double65) {
                    double65 = double67;
                    byte9 = 6;
                } else if (double64 < double65 && double67 > double64) {
                    double64 = double67;
                    byte8 = 6;
                }
            }

            double double68 = 2.0 - double14 + double10;
            if (double64 >= double65 && double68 > double65) {
                double65 = double68;
                byte9 = 1;
                boolean1 = false;
            } else if (double64 < double65 && double68 > double64) {
                double64 = double68;
                byte8 = 1;
                boolean0 = false;
            }

            double double69 = 2.0 - double14 + double11;
            if (double64 >= double65 && double69 > double65) {
                double65 = double69;
                byte9 = 2;
                boolean1 = false;
            } else if (double64 < double65 && double69 > double64) {
                double64 = double69;
                byte8 = 2;
                boolean0 = false;
            }

            double double70 = 2.0 - double14 + double12;
            if (double64 >= double65 && double70 > double65) {
                double65 = double70;
                byte9 = 4;
                boolean1 = false;
            } else if (double64 < double65 && double70 > double64) {
                double64 = double70;
                byte8 = 4;
                boolean0 = false;
            }

            double double71 = 2.0 - double14 + double13;
            if (double64 >= double65 && double71 > double65) {
                byte9 = 8;
                boolean1 = false;
            } else if (double64 < double65 && double71 > double64) {
                byte8 = 8;
                boolean0 = false;
            }

            if (boolean0 == boolean1) {
                if (boolean0) {
                    byte byte10 = (byte)(byte8 | byte9);
                    byte byte11 = (byte)(byte8 & byte9);
                    if ((byte10 & 1) == 0) {
                        int4 = int0;
                        int8 = int0 - 1;
                        double20 = double15 - 0.927050983124841;
                        double24 = double15 + 1.0 - 0.618033988749894;
                    } else {
                        int4 = int8 = int0 + 1;
                        double20 = double15 - 1.0 - 0.927050983124841;
                        double24 = double15 - 1.0 - 0.618033988749894;
                    }

                    if ((byte10 & 2) == 0) {
                        int5 = int1;
                        int9 = int1 - 1;
                        double21 = double16 - 0.927050983124841;
                        double25 = double16 + 1.0 - 0.618033988749894;
                    } else {
                        int5 = int9 = int1 + 1;
                        double21 = double16 - 1.0 - 0.927050983124841;
                        double25 = double16 - 1.0 - 0.618033988749894;
                    }

                    if ((byte10 & 4) == 0) {
                        int6 = int2;
                        int10 = int2 - 1;
                        double22 = double17 - 0.927050983124841;
                        double26 = double17 + 1.0 - 0.618033988749894;
                    } else {
                        int6 = int10 = int2 + 1;
                        double22 = double17 - 1.0 - 0.927050983124841;
                        double26 = double17 - 1.0 - 0.618033988749894;
                    }

                    if ((byte10 & 8) == 0) {
                        int7 = int3;
                        int11 = int3 - 1;
                        double23 = double18 - 0.927050983124841;
                        double27 = double18 + 1.0 - 0.618033988749894;
                    } else {
                        int7 = int11 = int3 + 1;
                        double23 = double18 - 1.0 - 0.927050983124841;
                        double27 = double18 - 1.0 - 0.618033988749894;
                    }

                    int12 = int0;
                    int13 = int1;
                    int14 = int2;
                    int15 = int3;
                    double28 = double15 - 0.618033988749894;
                    double29 = double16 - 0.618033988749894;
                    double30 = double17 - 0.618033988749894;
                    double31 = double18 - 0.618033988749894;
                    if ((byte11 & 1) != 0) {
                        int12 = int0 + 2;
                        double28 -= 2.0;
                    } else if ((byte11 & 2) != 0) {
                        int13 = int1 + 2;
                        double29 -= 2.0;
                    } else if ((byte11 & 4) != 0) {
                        int14 = int2 + 2;
                        double30 -= 2.0;
                    } else {
                        int15 = int3 + 2;
                        double31 -= 2.0;
                    }
                } else {
                    int12 = int0;
                    int13 = int1;
                    int14 = int2;
                    int15 = int3;
                    double28 = double15;
                    double29 = double16;
                    double30 = double17;
                    double31 = double18;
                    byte byte12 = (byte)(byte8 | byte9);
                    if ((byte12 & 1) == 0) {
                        int4 = int0 - 1;
                        int8 = int0;
                        double20 = double15 + 1.0 - 0.309016994374947;
                        double24 = double15 - 0.309016994374947;
                    } else {
                        int4 = int8 = int0 + 1;
                        double20 = double24 = double15 - 1.0 - 0.309016994374947;
                    }

                    if ((byte12 & 2) == 0) {
                        int9 = int1;
                        int5 = int1;
                        double21 = double25 = double16 - 0.309016994374947;
                        if ((byte12 & 1) == 1) {
                            int5 = int1 - 1;
                            double21++;
                        } else {
                            int9 = int1 - 1;
                            double25++;
                        }
                    } else {
                        int5 = int9 = int1 + 1;
                        double21 = double25 = double16 - 1.0 - 0.309016994374947;
                    }

                    if ((byte12 & 4) == 0) {
                        int10 = int2;
                        int6 = int2;
                        double22 = double26 = double17 - 0.309016994374947;
                        if ((byte12 & 3) == 3) {
                            int6 = int2 - 1;
                            double22++;
                        } else {
                            int10 = int2 - 1;
                            double26++;
                        }
                    } else {
                        int6 = int10 = int2 + 1;
                        double22 = double26 = double17 - 1.0 - 0.309016994374947;
                    }

                    if ((byte12 & 8) == 0) {
                        int7 = int3;
                        int11 = int3 - 1;
                        double23 = double18 - 0.309016994374947;
                        double27 = double18 + 1.0 - 0.309016994374947;
                    } else {
                        int7 = int11 = int3 + 1;
                        double23 = double27 = double18 - 1.0 - 0.309016994374947;
                    }
                }
            } else {
                byte byte13;
                byte byte14;
                if (boolean0) {
                    byte13 = byte8;
                    byte14 = byte9;
                } else {
                    byte13 = byte9;
                    byte14 = byte8;
                }

                if ((byte13 & 1) == 0) {
                    int4 = int0 - 1;
                    int8 = int0;
                    double20 = double15 + 1.0 - 0.309016994374947;
                    double24 = double15 - 0.309016994374947;
                } else {
                    int4 = int8 = int0 + 1;
                    double20 = double24 = double15 - 1.0 - 0.309016994374947;
                }

                if ((byte13 & 2) == 0) {
                    int9 = int1;
                    int5 = int1;
                    double21 = double25 = double16 - 0.309016994374947;
                    if ((byte13 & 1) == 1) {
                        int5 = int1 - 1;
                        double21++;
                    } else {
                        int9 = int1 - 1;
                        double25++;
                    }
                } else {
                    int5 = int9 = int1 + 1;
                    double21 = double25 = double16 - 1.0 - 0.309016994374947;
                }

                if ((byte13 & 4) == 0) {
                    int10 = int2;
                    int6 = int2;
                    double22 = double26 = double17 - 0.309016994374947;
                    if ((byte13 & 3) == 3) {
                        int6 = int2 - 1;
                        double22++;
                    } else {
                        int10 = int2 - 1;
                        double26++;
                    }
                } else {
                    int6 = int10 = int2 + 1;
                    double22 = double26 = double17 - 1.0 - 0.309016994374947;
                }

                if ((byte13 & 8) == 0) {
                    int7 = int3;
                    int11 = int3 - 1;
                    double23 = double18 - 0.309016994374947;
                    double27 = double18 + 1.0 - 0.309016994374947;
                } else {
                    int7 = int11 = int3 + 1;
                    double23 = double27 = double18 - 1.0 - 0.309016994374947;
                }

                int12 = int0;
                int13 = int1;
                int14 = int2;
                int15 = int3;
                double28 = double15 - 0.618033988749894;
                double29 = double16 - 0.618033988749894;
                double30 = double17 - 0.618033988749894;
                double31 = double18 - 0.618033988749894;
                if ((byte14 & 1) != 0) {
                    int12 = int0 + 2;
                    double28 -= 2.0;
                } else if ((byte14 & 2) != 0) {
                    int13 = int1 + 2;
                    double29 -= 2.0;
                } else if ((byte14 & 4) != 0) {
                    int14 = int2 + 2;
                    double30 -= 2.0;
                } else {
                    int15 = int3 + 2;
                    double31 -= 2.0;
                }
            }

            double double72 = double15 - 1.0 - 0.309016994374947;
            double double73 = double16 - 0.0 - 0.309016994374947;
            double double74 = double17 - 0.0 - 0.309016994374947;
            double double75 = double18 - 0.0 - 0.309016994374947;
            double double76 = 2.0 - double72 * double72 - double73 * double73 - double74 * double74 - double75 * double75;
            if (double76 > 0.0) {
                double76 *= double76;
                double19 += double76 * double76 * this.extrapolate(int0 + 1, int1 + 0, int2 + 0, int3 + 0, double72, double73, double74, double75);
            }

            double double77 = double15 - 0.0 - 0.309016994374947;
            double double78 = double16 - 1.0 - 0.309016994374947;
            double double79 = 2.0 - double77 * double77 - double78 * double78 - double74 * double74 - double75 * double75;
            if (double79 > 0.0) {
                double79 *= double79;
                double19 += double79 * double79 * this.extrapolate(int0 + 0, int1 + 1, int2 + 0, int3 + 0, double77, double78, double74, double75);
            }

            double double80 = double17 - 1.0 - 0.309016994374947;
            double double81 = 2.0 - double77 * double77 - double73 * double73 - double80 * double80 - double75 * double75;
            if (double81 > 0.0) {
                double81 *= double81;
                double19 += double81 * double81 * this.extrapolate(int0 + 0, int1 + 0, int2 + 1, int3 + 0, double77, double73, double80, double75);
            }

            double double82 = double18 - 1.0 - 0.309016994374947;
            double double83 = 2.0 - double77 * double77 - double73 * double73 - double74 * double74 - double82 * double82;
            if (double83 > 0.0) {
                double83 *= double83;
                double19 += double83 * double83 * this.extrapolate(int0 + 0, int1 + 0, int2 + 0, int3 + 1, double77, double73, double74, double82);
            }

            double double84 = double15 - 1.0 - 0.618033988749894;
            double double85 = double16 - 1.0 - 0.618033988749894;
            double double86 = double17 - 0.0 - 0.618033988749894;
            double double87 = double18 - 0.0 - 0.618033988749894;
            double double88 = 2.0 - double84 * double84 - double85 * double85 - double86 * double86 - double87 * double87;
            if (double88 > 0.0) {
                double88 *= double88;
                double19 += double88 * double88 * this.extrapolate(int0 + 1, int1 + 1, int2 + 0, int3 + 0, double84, double85, double86, double87);
            }

            double double89 = double15 - 1.0 - 0.618033988749894;
            double double90 = double16 - 0.0 - 0.618033988749894;
            double double91 = double17 - 1.0 - 0.618033988749894;
            double double92 = double18 - 0.0 - 0.618033988749894;
            double double93 = 2.0 - double89 * double89 - double90 * double90 - double91 * double91 - double92 * double92;
            if (double93 > 0.0) {
                double93 *= double93;
                double19 += double93 * double93 * this.extrapolate(int0 + 1, int1 + 0, int2 + 1, int3 + 0, double89, double90, double91, double92);
            }

            double double94 = double15 - 1.0 - 0.618033988749894;
            double double95 = double16 - 0.0 - 0.618033988749894;
            double double96 = double17 - 0.0 - 0.618033988749894;
            double double97 = double18 - 1.0 - 0.618033988749894;
            double double98 = 2.0 - double94 * double94 - double95 * double95 - double96 * double96 - double97 * double97;
            if (double98 > 0.0) {
                double98 *= double98;
                double19 += double98 * double98 * this.extrapolate(int0 + 1, int1 + 0, int2 + 0, int3 + 1, double94, double95, double96, double97);
            }

            double double99 = double15 - 0.0 - 0.618033988749894;
            double double100 = double16 - 1.0 - 0.618033988749894;
            double double101 = double17 - 1.0 - 0.618033988749894;
            double double102 = double18 - 0.0 - 0.618033988749894;
            double double103 = 2.0 - double99 * double99 - double100 * double100 - double101 * double101 - double102 * double102;
            if (double103 > 0.0) {
                double103 *= double103;
                double19 += double103 * double103 * this.extrapolate(int0 + 0, int1 + 1, int2 + 1, int3 + 0, double99, double100, double101, double102);
            }

            double double104 = double15 - 0.0 - 0.618033988749894;
            double double105 = double16 - 1.0 - 0.618033988749894;
            double double106 = double17 - 0.0 - 0.618033988749894;
            double double107 = double18 - 1.0 - 0.618033988749894;
            double double108 = 2.0 - double104 * double104 - double105 * double105 - double106 * double106 - double107 * double107;
            if (double108 > 0.0) {
                double108 *= double108;
                double19 += double108 * double108 * this.extrapolate(int0 + 0, int1 + 1, int2 + 0, int3 + 1, double104, double105, double106, double107);
            }

            double double109 = double15 - 0.0 - 0.618033988749894;
            double double110 = double16 - 0.0 - 0.618033988749894;
            double double111 = double17 - 1.0 - 0.618033988749894;
            double double112 = double18 - 1.0 - 0.618033988749894;
            double double113 = 2.0 - double109 * double109 - double110 * double110 - double111 * double111 - double112 * double112;
            if (double113 > 0.0) {
                double113 *= double113;
                double19 += double113 * double113 * this.extrapolate(int0 + 0, int1 + 0, int2 + 1, int3 + 1, double109, double110, double111, double112);
            }
        } else {
            boolean boolean2 = true;
            boolean boolean3 = true;
            double double114;
            byte byte15;
            if (double10 + double11 < double12 + double13) {
                double114 = double10 + double11;
                byte15 = 12;
            } else {
                double114 = double12 + double13;
                byte15 = 3;
            }

            double double115;
            byte byte16;
            if (double10 + double12 < double11 + double13) {
                double115 = double10 + double12;
                byte16 = 10;
            } else {
                double115 = double11 + double13;
                byte16 = 5;
            }

            if (double10 + double13 < double11 + double12) {
                double double116 = double10 + double13;
                if (double114 <= double115 && double116 < double115) {
                    double115 = double116;
                    byte16 = 6;
                } else if (double114 > double115 && double116 < double114) {
                    double114 = double116;
                    byte15 = 6;
                }
            } else {
                double double117 = double11 + double12;
                if (double114 <= double115 && double117 < double115) {
                    double115 = double117;
                    byte16 = 9;
                } else if (double114 > double115 && double117 < double114) {
                    double114 = double117;
                    byte15 = 9;
                }
            }

            double double118 = 3.0 - double14 + double10;
            if (double114 <= double115 && double118 < double115) {
                double115 = double118;
                byte16 = 14;
                boolean3 = false;
            } else if (double114 > double115 && double118 < double114) {
                double114 = double118;
                byte15 = 14;
                boolean2 = false;
            }

            double double119 = 3.0 - double14 + double11;
            if (double114 <= double115 && double119 < double115) {
                double115 = double119;
                byte16 = 13;
                boolean3 = false;
            } else if (double114 > double115 && double119 < double114) {
                double114 = double119;
                byte15 = 13;
                boolean2 = false;
            }

            double double120 = 3.0 - double14 + double12;
            if (double114 <= double115 && double120 < double115) {
                double115 = double120;
                byte16 = 11;
                boolean3 = false;
            } else if (double114 > double115 && double120 < double114) {
                double114 = double120;
                byte15 = 11;
                boolean2 = false;
            }

            double double121 = 3.0 - double14 + double13;
            if (double114 <= double115 && double121 < double115) {
                byte16 = 7;
                boolean3 = false;
            } else if (double114 > double115 && double121 < double114) {
                byte15 = 7;
                boolean2 = false;
            }

            if (boolean2 == boolean3) {
                if (boolean2) {
                    byte byte17 = (byte)(byte15 & byte16);
                    byte byte18 = (byte)(byte15 | byte16);
                    int8 = int0;
                    int4 = int0;
                    int9 = int1;
                    int5 = int1;
                    int10 = int2;
                    int6 = int2;
                    int11 = int3;
                    int7 = int3;
                    double20 = double15 - 0.309016994374947;
                    double21 = double16 - 0.309016994374947;
                    double22 = double17 - 0.309016994374947;
                    double23 = double18 - 0.309016994374947;
                    double24 = double15 - 0.618033988749894;
                    double25 = double16 - 0.618033988749894;
                    double26 = double17 - 0.618033988749894;
                    double27 = double18 - 0.618033988749894;
                    if ((byte17 & 1) != 0) {
                        int4 = int0 + 1;
                        double20--;
                        int8 = int0 + 2;
                        double24 -= 2.0;
                    } else if ((byte17 & 2) != 0) {
                        int5 = int1 + 1;
                        double21--;
                        int9 = int1 + 2;
                        double25 -= 2.0;
                    } else if ((byte17 & 4) != 0) {
                        int6 = int2 + 1;
                        double22--;
                        int10 = int2 + 2;
                        double26 -= 2.0;
                    } else {
                        int7 = int3 + 1;
                        double23--;
                        int11 = int3 + 2;
                        double27 -= 2.0;
                    }

                    int12 = int0 + 1;
                    int13 = int1 + 1;
                    int14 = int2 + 1;
                    int15 = int3 + 1;
                    double28 = double15 - 1.0 - 0.618033988749894;
                    double29 = double16 - 1.0 - 0.618033988749894;
                    double30 = double17 - 1.0 - 0.618033988749894;
                    double31 = double18 - 1.0 - 0.618033988749894;
                    if ((byte18 & 1) == 0) {
                        int12 -= 2;
                        double28 += 2.0;
                    } else if ((byte18 & 2) == 0) {
                        int13 -= 2;
                        double29 += 2.0;
                    } else if ((byte18 & 4) == 0) {
                        int14 -= 2;
                        double30 += 2.0;
                    } else {
                        int15 -= 2;
                        double31 += 2.0;
                    }
                } else {
                    int12 = int0 + 1;
                    int13 = int1 + 1;
                    int14 = int2 + 1;
                    int15 = int3 + 1;
                    double28 = double15 - 1.0 - 1.236067977499788;
                    double29 = double16 - 1.0 - 1.236067977499788;
                    double30 = double17 - 1.0 - 1.236067977499788;
                    double31 = double18 - 1.0 - 1.236067977499788;
                    byte byte19 = (byte)(byte15 & byte16);
                    if ((byte19 & 1) != 0) {
                        int4 = int0 + 2;
                        int8 = int0 + 1;
                        double20 = double15 - 2.0 - 0.927050983124841;
                        double24 = double15 - 1.0 - 0.927050983124841;
                    } else {
                        int8 = int0;
                        int4 = int0;
                        double20 = double24 = double15 - 0.927050983124841;
                    }

                    if ((byte19 & 2) != 0) {
                        int5 = int9 = int1 + 1;
                        double21 = double25 = double16 - 1.0 - 0.927050983124841;
                        if ((byte19 & 1) == 0) {
                            int5++;
                            double21--;
                        } else {
                            int9++;
                            double25--;
                        }
                    } else {
                        int9 = int1;
                        int5 = int1;
                        double21 = double25 = double16 - 0.927050983124841;
                    }

                    if ((byte19 & 4) != 0) {
                        int6 = int10 = int2 + 1;
                        double22 = double26 = double17 - 1.0 - 0.927050983124841;
                        if ((byte19 & 3) == 0) {
                            int6++;
                            double22--;
                        } else {
                            int10++;
                            double26--;
                        }
                    } else {
                        int10 = int2;
                        int6 = int2;
                        double22 = double26 = double17 - 0.927050983124841;
                    }

                    if ((byte19 & 8) != 0) {
                        int7 = int3 + 1;
                        int11 = int3 + 2;
                        double23 = double18 - 1.0 - 0.927050983124841;
                        double27 = double18 - 2.0 - 0.927050983124841;
                    } else {
                        int11 = int3;
                        int7 = int3;
                        double23 = double27 = double18 - 0.927050983124841;
                    }
                }
            } else {
                byte byte20;
                byte byte21;
                if (boolean2) {
                    byte20 = byte15;
                    byte21 = byte16;
                } else {
                    byte20 = byte16;
                    byte21 = byte15;
                }

                if ((byte20 & 1) != 0) {
                    int4 = int0 + 2;
                    int8 = int0 + 1;
                    double20 = double15 - 2.0 - 0.927050983124841;
                    double24 = double15 - 1.0 - 0.927050983124841;
                } else {
                    int8 = int0;
                    int4 = int0;
                    double20 = double24 = double15 - 0.927050983124841;
                }

                if ((byte20 & 2) != 0) {
                    int5 = int9 = int1 + 1;
                    double21 = double25 = double16 - 1.0 - 0.927050983124841;
                    if ((byte20 & 1) == 0) {
                        int5++;
                        double21--;
                    } else {
                        int9++;
                        double25--;
                    }
                } else {
                    int9 = int1;
                    int5 = int1;
                    double21 = double25 = double16 - 0.927050983124841;
                }

                if ((byte20 & 4) != 0) {
                    int6 = int10 = int2 + 1;
                    double22 = double26 = double17 - 1.0 - 0.927050983124841;
                    if ((byte20 & 3) == 0) {
                        int6++;
                        double22--;
                    } else {
                        int10++;
                        double26--;
                    }
                } else {
                    int10 = int2;
                    int6 = int2;
                    double22 = double26 = double17 - 0.927050983124841;
                }

                if ((byte20 & 8) != 0) {
                    int7 = int3 + 1;
                    int11 = int3 + 2;
                    double23 = double18 - 1.0 - 0.927050983124841;
                    double27 = double18 - 2.0 - 0.927050983124841;
                } else {
                    int11 = int3;
                    int7 = int3;
                    double23 = double27 = double18 - 0.927050983124841;
                }

                int12 = int0 + 1;
                int13 = int1 + 1;
                int14 = int2 + 1;
                int15 = int3 + 1;
                double28 = double15 - 1.0 - 0.618033988749894;
                double29 = double16 - 1.0 - 0.618033988749894;
                double30 = double17 - 1.0 - 0.618033988749894;
                double31 = double18 - 1.0 - 0.618033988749894;
                if ((byte21 & 1) == 0) {
                    int12 -= 2;
                    double28 += 2.0;
                } else if ((byte21 & 2) == 0) {
                    int13 -= 2;
                    double29 += 2.0;
                } else if ((byte21 & 4) == 0) {
                    int14 -= 2;
                    double30 += 2.0;
                } else {
                    int15 -= 2;
                    double31 += 2.0;
                }
            }

            double double122 = double15 - 1.0 - 0.927050983124841;
            double double123 = double16 - 1.0 - 0.927050983124841;
            double double124 = double17 - 1.0 - 0.927050983124841;
            double double125 = double18 - 0.927050983124841;
            double double126 = 2.0 - double122 * double122 - double123 * double123 - double124 * double124 - double125 * double125;
            if (double126 > 0.0) {
                double126 *= double126;
                double19 += double126 * double126 * this.extrapolate(int0 + 1, int1 + 1, int2 + 1, int3 + 0, double122, double123, double124, double125);
            }

            double double127 = double17 - 0.927050983124841;
            double double128 = double18 - 1.0 - 0.927050983124841;
            double double129 = 2.0 - double122 * double122 - double123 * double123 - double127 * double127 - double128 * double128;
            if (double129 > 0.0) {
                double129 *= double129;
                double19 += double129 * double129 * this.extrapolate(int0 + 1, int1 + 1, int2 + 0, int3 + 1, double122, double123, double127, double128);
            }

            double double130 = double16 - 0.927050983124841;
            double double131 = 2.0 - double122 * double122 - double130 * double130 - double124 * double124 - double128 * double128;
            if (double131 > 0.0) {
                double131 *= double131;
                double19 += double131 * double131 * this.extrapolate(int0 + 1, int1 + 0, int2 + 1, int3 + 1, double122, double130, double124, double128);
            }

            double double132 = double15 - 0.927050983124841;
            double double133 = 2.0 - double132 * double132 - double123 * double123 - double124 * double124 - double128 * double128;
            if (double133 > 0.0) {
                double133 *= double133;
                double19 += double133 * double133 * this.extrapolate(int0 + 0, int1 + 1, int2 + 1, int3 + 1, double132, double123, double124, double128);
            }

            double double134 = double15 - 1.0 - 0.618033988749894;
            double double135 = double16 - 1.0 - 0.618033988749894;
            double double136 = double17 - 0.0 - 0.618033988749894;
            double double137 = double18 - 0.0 - 0.618033988749894;
            double double138 = 2.0 - double134 * double134 - double135 * double135 - double136 * double136 - double137 * double137;
            if (double138 > 0.0) {
                double138 *= double138;
                double19 += double138 * double138 * this.extrapolate(int0 + 1, int1 + 1, int2 + 0, int3 + 0, double134, double135, double136, double137);
            }

            double double139 = double15 - 1.0 - 0.618033988749894;
            double double140 = double16 - 0.0 - 0.618033988749894;
            double double141 = double17 - 1.0 - 0.618033988749894;
            double double142 = double18 - 0.0 - 0.618033988749894;
            double double143 = 2.0 - double139 * double139 - double140 * double140 - double141 * double141 - double142 * double142;
            if (double143 > 0.0) {
                double143 *= double143;
                double19 += double143 * double143 * this.extrapolate(int0 + 1, int1 + 0, int2 + 1, int3 + 0, double139, double140, double141, double142);
            }

            double double144 = double15 - 1.0 - 0.618033988749894;
            double double145 = double16 - 0.0 - 0.618033988749894;
            double double146 = double17 - 0.0 - 0.618033988749894;
            double double147 = double18 - 1.0 - 0.618033988749894;
            double double148 = 2.0 - double144 * double144 - double145 * double145 - double146 * double146 - double147 * double147;
            if (double148 > 0.0) {
                double148 *= double148;
                double19 += double148 * double148 * this.extrapolate(int0 + 1, int1 + 0, int2 + 0, int3 + 1, double144, double145, double146, double147);
            }

            double double149 = double15 - 0.0 - 0.618033988749894;
            double double150 = double16 - 1.0 - 0.618033988749894;
            double double151 = double17 - 1.0 - 0.618033988749894;
            double double152 = double18 - 0.0 - 0.618033988749894;
            double double153 = 2.0 - double149 * double149 - double150 * double150 - double151 * double151 - double152 * double152;
            if (double153 > 0.0) {
                double153 *= double153;
                double19 += double153 * double153 * this.extrapolate(int0 + 0, int1 + 1, int2 + 1, int3 + 0, double149, double150, double151, double152);
            }

            double double154 = double15 - 0.0 - 0.618033988749894;
            double double155 = double16 - 1.0 - 0.618033988749894;
            double double156 = double17 - 0.0 - 0.618033988749894;
            double double157 = double18 - 1.0 - 0.618033988749894;
            double double158 = 2.0 - double154 * double154 - double155 * double155 - double156 * double156 - double157 * double157;
            if (double158 > 0.0) {
                double158 *= double158;
                double19 += double158 * double158 * this.extrapolate(int0 + 0, int1 + 1, int2 + 0, int3 + 1, double154, double155, double156, double157);
            }

            double double159 = double15 - 0.0 - 0.618033988749894;
            double double160 = double16 - 0.0 - 0.618033988749894;
            double double161 = double17 - 1.0 - 0.618033988749894;
            double double162 = double18 - 1.0 - 0.618033988749894;
            double double163 = 2.0 - double159 * double159 - double160 * double160 - double161 * double161 - double162 * double162;
            if (double163 > 0.0) {
                double163 *= double163;
                double19 += double163 * double163 * this.extrapolate(int0 + 0, int1 + 0, int2 + 1, int3 + 1, double159, double160, double161, double162);
            }
        }

        double double164 = 2.0 - double20 * double20 - double21 * double21 - double22 * double22 - double23 * double23;
        if (double164 > 0.0) {
            double164 *= double164;
            double19 += double164 * double164 * this.extrapolate(int4, int5, int6, int7, double20, double21, double22, double23);
        }

        double double165 = 2.0 - double24 * double24 - double25 * double25 - double26 * double26 - double27 * double27;
        if (double165 > 0.0) {
            double165 *= double165;
            double19 += double165 * double165 * this.extrapolate(int8, int9, int10, int11, double24, double25, double26, double27);
        }

        double double166 = 2.0 - double28 * double28 - double29 * double29 - double30 * double30 - double31 * double31;
        if (double166 > 0.0) {
            double166 *= double166;
            double19 += double166 * double166 * this.extrapolate(int12, int13, int14, int15, double28, double29, double30, double31);
        }

        return double19 / 30.0;
    }

    private double extrapolate(int int2, int int1, double double1, double double0) {
        int int0 = this.perm[this.perm[int2 & 0xFF] + int1 & 0xFF] & 14;
        return (double)gradients2D[int0] * double1 + (double)gradients2D[int0 + 1] * double0;
    }

    private double extrapolate(int int2, int int1, int int0, double double2, double double1, double double0) {
        short _short = this.permGradIndex3D[this.perm[this.perm[int2 & 0xFF] + int1 & 0xFF] + int0 & 0xFF];
        return (double)gradients3D[_short] * double2 + (double)gradients3D[_short + 1] * double1 + (double)gradients3D[_short + 2] * double0;
    }

    private double extrapolate(int int4, int int3, int int2, int int1, double double3, double double2, double double1, double double0) {
        int int0 = this.perm[this.perm[this.perm[this.perm[int4 & 0xFF] + int3 & 0xFF] + int2 & 0xFF] + int1 & 0xFF] & 252;
        return (double)gradients4D[int0] * double3
            + (double)gradients4D[int0 + 1] * double2
            + (double)gradients4D[int0 + 2] * double1
            + (double)gradients4D[int0 + 3] * double0;
    }

    private static int fastFloor(double _double) {
        int _int = (int)_double;
        return _double < (double)_int ? _int - 1 : _int;
    }

    public double evalOct(float v, float v1, int i) {
        boolean _boolean = true;
        double _double = this.eval((double)v, (double)v1, (double)i);

        for (int _int = 2; _int <= 64; _int++) {
            _double += this.eval((double)(v * (float)_int * v), (double)(v1 * (float)_int * v1), (double)(i * _int * i));
        }

        return _double;
    }
}
